QuickOPC User's Guide and Reference
GetItemPropertyRecord(IEasyDAClient,ServerDescriptor,DANodeDescriptor,IEnumerable<DAPropertyId>,Boolean) Method
Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.DataAccess.Extensions Namespace > IEasyDAClientExtension2 Class > GetItemPropertyRecord Method : GetItemPropertyRecord(IEasyDAClient,ServerDescriptor,DANodeDescriptor,IEnumerable<DAPropertyId>,Boolean) Method
The client object that will perform the operation.
The OPC server involved in the operation.
The descriptor of the OPC node involved in the operation.
Specifies which OPC properties should be obtained and returned.
If false, any failures cause the method to throw an exception. If true, failures are ignored, and the affected OPC properties will contain default values.
Obtains a DAItemPropertyRecord structure filled with OPC property values for a given OPC item. Obtains a structure filled with OPC property values for a given OPC item. You can specify the property Ids.
Syntax
'Declaration
 
<ExtensionAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function GetItemPropertyRecord( _
   ByVal client As IEasyDAClient, _
   ByVal serverDescriptor As ServerDescriptor, _
   ByVal nodeDescriptor As DANodeDescriptor, _
   ByVal propertyIds As IEnumerable(Of DAPropertyId), _
   ByVal allowFailures As Boolean _
) As DAItemPropertyRecord
'Usage
 
Dim client As IEasyDAClient
Dim serverDescriptor As ServerDescriptor
Dim nodeDescriptor As DANodeDescriptor
Dim propertyIds As IEnumerable(Of DAPropertyId)
Dim allowFailures As Boolean
Dim value As DAItemPropertyRecord
 
value = IEasyDAClientExtension2.GetItemPropertyRecord(client, serverDescriptor, nodeDescriptor, propertyIds, allowFailures)

Parameters

client
The client object that will perform the operation.
serverDescriptor
The OPC server involved in the operation.
nodeDescriptor
The descriptor of the OPC node involved in the operation.
propertyIds
Specifies which OPC properties should be obtained and returned.
allowFailures
If false, any failures cause the method to throw an exception. If true, failures are ignored, and the affected OPC properties will contain default values.

Return Value

Returns a structure containing the OPC property values requested.
Exceptions
ExceptionDescription
The OPC "Classic" (or OPC XML-DA) operation has failed.
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
Remarks

This method allows you to obtain a structure filled in with property values for a given OPC item. It can retrieve all well-known properties at once, or you can pass in a set of property Ids that you are interested in. You can then simply use the properties in the resulting DAItemPropertyRecord structure, without further looking up the values in any way.

Using implicit conversions, you can pass an item ID in place of node descriptor.

Example
// This example shows how to obtain a structure containing property values for an OPC item, and display some property values.

using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.Extensions;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.DataAccess._EasyDAClientExtension
{
    class GetItemPropertyRecord
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            // Get a structure containing values of all well-known properties
            DAItemPropertyRecord itemPropertyRecord;
            try
            {
                itemPropertyRecord = client.GetItemPropertyRecord("", "OPCLabs.KitServer.2", "Simulation.Random");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            // Display some of the obtained property values
            Console.WriteLine("itemPropertyRecord.AccessRights: {0}", itemPropertyRecord.AccessRights);
            Console.WriteLine("itemPropertyRecord.DataType: {0}", itemPropertyRecord.DataType);
            Console.WriteLine("itemPropertyRecord.Timestamp: {0}", itemPropertyRecord.Timestamp);
        }
    }
}
' This example shows how to obtain a structure containing property values for an OPC item, and display some property values.

Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.DataAccess.Extensions
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.DataAccess._EasyDAClientExtension
    Friend Class GetItemPropertyRecord
        Public Shared Sub Main1()
            Dim client = New EasyDAClient()

            ' Get a structure containing values of all well-known properties
            Dim itemPropertyRecord As DAItemPropertyRecord
            Try
                itemPropertyRecord = client.GetItemPropertyRecord("", "OPCLabs.KitServer.2", "Simulation.Random")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            ' Display some of the obtained property values
            Console.WriteLine("itemPropertyRecord.AccessRights: {0}", itemPropertyRecord.AccessRights)
            Console.WriteLine("itemPropertyRecord.DataType: {0}", itemPropertyRecord.DataType)
            Console.WriteLine("itemPropertyRecord.Timestamp: {0}", itemPropertyRecord.Timestamp)
        End Sub
    End Class
End Namespace
// This example shows how to obtain a structure containing property values for an OPC item, and display some property values.

using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.Extensions;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.DataAccess._EasyDAClientExtension
{
    class GetItemPropertyRecord
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            // Get a structure containing values of all well-known properties
            DAItemPropertyRecord itemPropertyRecord;
            try
            {
                itemPropertyRecord = client.GetItemPropertyRecord("", "OPCLabs.KitServer.2", "Simulation.Random");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            // Display some of the obtained property values
            Console.WriteLine("itemPropertyRecord.AccessRights: {0}", itemPropertyRecord.AccessRights);
            Console.WriteLine("itemPropertyRecord.DataType: {0}", itemPropertyRecord.DataType);
            Console.WriteLine("itemPropertyRecord.Timestamp: {0}", itemPropertyRecord.Timestamp);
        }
    }
}
' This example shows how to obtain a structure containing property values for an OPC item, and display some property values.

Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.DataAccess.Extensions
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.DataAccess._EasyDAClientExtension
    Friend Class GetItemPropertyRecord
        Public Shared Sub Main1()
            Dim client = New EasyDAClient()

            ' Get a structure containing values of all well-known properties
            Dim itemPropertyRecord As DAItemPropertyRecord
            Try
                itemPropertyRecord = client.GetItemPropertyRecord("", "OPCLabs.KitServer.2", "Simulation.Random")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            ' Display some of the obtained property values
            Console.WriteLine("itemPropertyRecord.AccessRights: {0}", itemPropertyRecord.AccessRights)
            Console.WriteLine("itemPropertyRecord.DataType: {0}", itemPropertyRecord.DataType)
            Console.WriteLine("itemPropertyRecord.Timestamp: {0}", itemPropertyRecord.Timestamp)
        End Sub
    End Class
End Namespace
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2012, Windows Server 2016; .NET Core, .NET 5, .NET 6: Linux, macOS, Microsoft Windows

See Also

Reference

IEasyDAClientExtension2 Class
IEasyDAClientExtension2 Members
Overload List